package com.Final.hj;

import android.content.Context;

public class LoginSQLManger {
    private static LoginSQLManger instance;
    private Context mContext;
    private static LonginSQLOpa opa;
    //定义两个常量
    public static String UNAME = "uname";
    public static String HIMGID = "hImgId";
    public static String TYPE = "type";
    public static String GENDER = "gender";
    public static String EMAIL = "email";

    //创建单一实例
    public static LoginSQLManger getInstance(Context context) {
        if (instance == null) {
            instance = new LoginSQLManger(context);
        }
        return instance;
    }

    //创建Useropa实例得到数据库的操作对象
    private LoginSQLManger(Context context) {
        this.mContext = context;
        opa = new LonginSQLOpa(context);
    }

    //数据插入
    public void insertInfo(SQLSavaInfo info) {
        opa.insert(info);
    }

    //数据查找
    public String findData(String myId, String data) {
        return opa.findData(myId, data);
    }

    //数据更新
    public void updateUser(String changeFlag, String myId, String data) {
        opa.update(changeFlag, myId, data);
    }

    //数据删除
//    public void delete(String name){
//        opa.delete(name);
//    }

    //数据查询
    public SQLSavaInfo queryAll() {
        return opa.queryAll();
    }

    //删除全部数据
    public void deleteAll(){
        opa.deleteAll();
    }
}
